package com.cloud.train.business.controller;

import jakarta.annotation.Resource;
import org.bouncycastle.jcajce.provider.symmetric.TEA;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RestController
public class RedisTestController {
    @Resource
    private RedisTemplate redisTemplate;
    @RequestMapping("/redis/set/{key}/{value}")
    public String set(@PathVariable String key,@PathVariable String value){
        redisTemplate.opsForValue().set(key,value,3600, TimeUnit.SECONDS);
        return "success";
    }
    @RequestMapping("/redis/get/{key}")
    public Object get(@PathVariable String key){
        Object object = redisTemplate.opsForValue().get(key);
        return object;
    }
}
